libR-sys
Low-level R library bindings
Installation
To build this library and test that everything is working as expected, run the following two commands in the library's top-level directory:
The build script has the following two dependencies:
- R: It needs to be installed and available in the search path.
- libclang: Depending on your operating system, you may need to set the
LIBCLANG_PATH
environment variable or addllvm-config
to your search path.
Linux-specific instructions
Set LIBCLANG_PATH
to the lib
directory of your llvm
installation. E.g.,
LIBCLANG_PATH=/usr/lib/llvm-3.9/lib
.
Windows-specific instructions
Ensure the preferred R binaries, are part of the PATH
, e.g. C:/R/R-4.0.2/bin/x64
.
For information on how to add environment variables on Windows, see here.
Add the mingw toolchains that are used to build R:
The default toolchain must be (stable|beta|nightly)-gnu
, e.g. to set the default
toolchain to be nightly mingw:
Install MSYS2
. Using scoop it is done by
To complete the installation, run msys2
once, then restart the terminal.
Run msys2
again, and install Clang and mingw-toolchain via
Add environment variable LIBCLANG_PATH
with the value pointing to where the
clang binaries are placed. If scoop was used then the path would be:
%USERPROFILE%\scoop\apps\msys2\current\mingw64\bin
.
Then from now on, in order to build this, use:
In order to build it without having to enter a mingw64
/mingw32
shell, then add these
paths to PATH
:
Mac-specific instructions
Install llvm-config
via homebrew with:
Add it to your search path via:
If you want to compile libR-sys
from within RStudio, you may also have to add the following line to your .Renviron
file:
PATH=/usr/local/opt/llvm/bin: